var globalVal = "我是全局变量";
function myFunction() {
  var localVal = "我是全局变量";
  console.log(globalVal);
  console.log(localVal);
  
}
myFunction();
console.log(globalVal);
console.log(localVal); // 报错